package crossrun.tool.pdf2img.ui.main;

import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;

import java.io.File;

import crossrun.tool.pdf2img.control.ExeThreadServics;
import crossrun.tool.pdf2img.util.FileUtils;

public class CacheFileViewModel extends ViewModel {
    private MutableLiveData ref = new MutableLiveData();

    public void deleteFile(File file, String index) {
        ExeThreadServics.obtain().run(new Runnable() {
            @Override
            public void run() {
                FileUtils.deleteFile(file);
                ref.postValue(index);
            }
        });
    }

    public MutableLiveData getRef() {
        return ref;
    }
}
